package com.atguigu.gmall.item.contoller;

import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.item.service.ItemService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * 商品详情对外暴露的接口
 * @author aaronmegs
 * @create 2020-02-23 7:44 下午
 */
@RestController
@RequestMapping("/api/item")
public class ItemApiController {

    @Autowired
    private ItemService itemService;

    // 商品详情页面 所有数据的请求
    @ApiOperation("所有详情页面 所有数据的请求")
    @GetMapping("{skuId}")
    public Result getSkuInfoBySkuId(@PathVariable(name = "skuId") Long skuId) {
        Map map = itemService.getSkuInfoBySkuId(skuId);
        return Result.ok(map);
    }
}
